Here we show the codes we used to make the plots in Figure 6

library(Seurat)
library(ggplot2)
library(gplots)
## 
## Attaching package: 'gplots'
## The following object is masked from 'package:stats':
## 
##     lowess
# Load in the data
load("RR6_spatial-seq_seurat_object.Rda")

# Emulate ggplot default colors
gg_color_hue <- function(n) {
  hues = seq(15, 375, length = n + 1)
  hcl(h = hues, l = 65, c = 100)[1:n]
}

# Set the colors to use
my_palette = gg_color_hue(6)[c(2,5,1,6,3)]
my_palette = c(my_palette, "grey60")

# Plot Figure 6b
SpatialPlot(spatial_rr6, image.alpha=0, pt.size.factor=2, stroke=0, cols=my_palette) +
  scale_y_reverse() + scale_x_reverse() + labs(fill=NULL) +
  guides(fill=guide_legend(override.aes=list(size=5)))

# Plot Figure 6c
SpatialFeaturePlot(spatial_rr6, features="CYBB", alpha=c(1, 1), pt.size.factor=1.8, min.cutoff="q70",
                   max.cutoff="q90") + scale_fill_gradient(low="grey90", high=gg_color_hue(6)[6])
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.

SpatialFeaturePlot(spatial_rr6, features="CCL5", alpha=c(1, 1), pt.size.factor=1.8, min.cutoff="q70",
                   max.cutoff="q90") + scale_fill_gradient(low="grey90", high=gg_color_hue(6)[5])
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.

SpatialFeaturePlot(spatial_rr6, features="MMP2", alpha=c(1, 1), pt.size.factor=1.8, min.cutoff="q70",
                   max.cutoff="q90") + scale_fill_gradient(low="grey90", high=gg_color_hue(6)[3])
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.

SpatialFeaturePlot(spatial_rr6, features="KLK5", alpha=c(1, 1), pt.size.factor=1.8, min.cutoff="q70",
                   max.cutoff="q90") + scale_fill_gradient(low="grey90", high=gg_color_hue(6)[1])
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.

# Plot Figure 6d
# Average expression by cluster for RR6
ave_expr_rr6 = read.csv("RR6_ave_expr_by_cluster.csv", row.names=1)
colnames(ave_expr_rr6) = gsub("X", "", colnames(ave_expr_rr6))
colnames(ave_expr_rr6) = paste(colnames(ave_expr_rr6), "RR6", sep="-")
ave_expr_rr6 = ave_expr_rr6[,1:5]
ave_expr_rr6 = t(scale(t(ave_expr_rr6)))
# Average expression by cluster for RR7
ave_expr_rr7 = read.csv("RR7_ave_expr_by_cluster.csv", row.names=1)
colnames(ave_expr_rr7) = gsub("X", "", colnames(ave_expr_rr7))
colnames(ave_expr_rr7) = paste(colnames(ave_expr_rr7), "RR7", sep="-")
ave_expr_rr7 = ave_expr_rr7[,c(2,4,1,5,3)]
ave_expr_rr7 = t(scale(t(ave_expr_rr7)))
# Average expression by cluster for RR8
ave_expr_rr8 = read.csv("RR8_ave_expr_by_cluster.csv", row.names=1)
colnames(ave_expr_rr8) = gsub("X", "", colnames(ave_expr_rr8))
colnames(ave_expr_rr8) = paste(colnames(ave_expr_rr8), "RR8", sep="-")
ave_expr_rr8 = ave_expr_rr8[,c(3,5,1,6,2)]
ave_expr_rr8 = t(scale(t(ave_expr_rr8)))
# Average expression by cluster for T-lep1
ave_expr_tlep1 = read.csv("Tlep1_ave_expr_by_cluster.csv", row.names=1)
colnames(ave_expr_tlep1) = gsub("X", "", colnames(ave_expr_tlep1))
colnames(ave_expr_tlep1) = paste(colnames(ave_expr_tlep1), "T-lep1", sep="-")
ave_expr_tlep1 = ave_expr_tlep1[,1:5]
ave_expr_tlep1 = t(scale(t(ave_expr_tlep1)))
# Combine the four datasets
genes = c("APP","CCL14","CCL21","CD40LG","CXCL13","IL32","CCL5","GZMB","PRF1","GNLY","DEFB1",
          "KRT6A","FLG2","KLK5","RNASE7","S100A7","CYBB","IDO1","MMP9","RNASE6","TXN",
          "CCL18","CYP27B1","CCL3","LYZ","ADM","CXCL12","MMP2","CXCL2","CXCL3","PLA2G2A")
ave_expr_rr6 = ave_expr_rr6[genes,]
ave_expr_rr7 = ave_expr_rr7[genes,]
ave_expr_rr8 = ave_expr_rr8[genes,]
ave_expr_tlep1 = ave_expr_tlep1[genes,]
ave_expr = cbind(ave_expr_rr6, ave_expr_rr7, ave_expr_rr8, ave_expr_tlep1)
ave_expr = ave_expr[,c(1,6,11,16,2,7,12,17,3,8,13,18,4,9,14,19,5,10,15,20)]
colnames(ave_expr) = paste(rep(c("EC","TC","KC","ML","FB"), each=4), rep(c("RR6","RR7","RR8","T-lep1"), 5), sep=" ")
# Plot the heatmap
my_palette = colorRampPalette(c("blue","white","red"))(n=100)
heatmap.2(as.matrix(t(ave_expr)), Rowv=FALSE, Colv=FALSE, dendrogram="none", scale="none",
          trace="none", key=TRUE, margins=c(10,10), adjCol=c(0.8,0.5),
          col=my_palette, key.title=NA, key.ylab=NA, cexCol=1, density.info="none", sepcolor="grey60",
          sepwidth=c(0.01,0.01), colsep=1:ncol(ave_expr), rowsep=1:nrow(ave_expr))

Session info

sessioninfo::session_info()
## Registered S3 method overwritten by 'cli':
##   method     from    
##   print.boxx spatstat
## Warning in system("timedatectl", intern = TRUE): running command 'timedatectl'
## had status 1
## ─ Session info ───────────────────────────────────────────────────────────────
##  setting  value                       
##  version  R version 3.6.0 (2019-04-26)
##  os       Red Hat Enterprise Linux    
##  system   x86_64, linux-gnu           
##  ui       X11                         
##  language (EN)                        
##  collate  en_US.UTF-8                 
##  ctype    en_US.UTF-8                 
##  tz       America/Los_Angeles         
##  date     2021-03-09                  
## 
## ─ Packages ───────────────────────────────────────────────────────────────────
##  package        * version  date       lib source        
##  abind            1.4-5    2016-07-21 [1] CRAN (R 3.6.0)
##  assertthat       0.2.1    2019-03-21 [1] CRAN (R 3.6.0)
##  bitops           1.0-6    2013-08-17 [2] CRAN (R 3.5.0)
##  caTools          1.18.0   2020-01-17 [1] CRAN (R 3.6.0)
##  cli              2.0.1    2020-01-08 [1] CRAN (R 3.6.0)
##  cluster          2.0.8    2019-04-05 [2] CRAN (R 3.6.0)
##  codetools        0.2-16   2018-12-24 [2] CRAN (R 3.6.0)
##  colorspace       1.4-1    2019-03-18 [1] CRAN (R 3.6.0)
##  cowplot          1.0.0    2019-07-11 [1] CRAN (R 3.6.0)
##  crayon           1.3.4    2017-09-16 [2] CRAN (R 3.5.0)
##  data.table       1.12.8   2019-12-09 [1] CRAN (R 3.6.0)
##  deldir           0.1-28   2020-07-15 [1] CRAN (R 3.6.0)
##  digest           0.6.23   2019-11-23 [1] CRAN (R 3.6.0)
##  dplyr            0.8.3    2019-07-04 [1] CRAN (R 3.6.0)
##  evaluate         0.14     2019-05-28 [1] CRAN (R 3.6.0)
##  fansi            0.4.1    2020-01-08 [1] CRAN (R 3.6.0)
##  farver           2.0.3    2020-01-16 [1] CRAN (R 3.6.0)
##  fastmap          1.0.1    2019-10-08 [1] CRAN (R 3.6.0)
##  fitdistrplus     1.0-14   2019-01-23 [2] CRAN (R 3.5.1)
##  future           1.16.0   2020-01-16 [1] CRAN (R 3.6.0)
##  future.apply     1.4.0    2020-01-07 [1] CRAN (R 3.6.0)
##  gdata            2.18.0   2017-06-06 [2] CRAN (R 3.5.0)
##  ggplot2        * 3.3.2    2020-06-19 [1] CRAN (R 3.6.0)
##  ggrepel          0.8.1    2019-05-07 [1] CRAN (R 3.6.0)
##  ggridges         0.5.2    2020-01-12 [1] CRAN (R 3.6.0)
##  globals          0.12.5   2019-12-07 [1] CRAN (R 3.6.0)
##  glue             1.4.2    2020-08-27 [1] CRAN (R 3.6.0)
##  goftest          1.2-2    2019-12-02 [1] CRAN (R 3.6.0)
##  gplots         * 3.0.3    2020-02-25 [1] CRAN (R 3.6.0)
##  gridExtra        2.3      2017-09-09 [2] CRAN (R 3.5.0)
##  gtable           0.3.0    2019-03-25 [1] CRAN (R 3.6.0)
##  gtools           3.8.1    2018-06-26 [2] CRAN (R 3.5.0)
##  htmltools        0.4.0    2019-10-04 [1] CRAN (R 3.6.0)
##  htmlwidgets      1.5.1    2019-10-08 [1] CRAN (R 3.6.0)
##  httpuv           1.5.2    2019-09-11 [1] CRAN (R 3.6.0)
##  httr             1.4.1    2019-08-05 [1] CRAN (R 3.6.0)
##  ica              1.0-2    2018-05-24 [2] CRAN (R 3.5.0)
##  igraph           1.2.4.2  2019-11-27 [1] CRAN (R 3.6.0)
##  irlba            2.3.3    2019-02-05 [2] CRAN (R 3.5.1)
##  jsonlite         1.7.1    2020-09-07 [2] CRAN (R 3.6.0)
##  KernSmooth       2.23-15  2015-06-29 [2] CRAN (R 3.6.0)
##  knitr            1.27     2020-01-16 [1] CRAN (R 3.6.0)
##  labeling         0.3      2014-08-23 [2] CRAN (R 3.5.0)
##  later            1.0.0    2019-10-04 [1] CRAN (R 3.6.0)
##  lattice          0.20-38  2018-11-04 [2] CRAN (R 3.6.0)
##  lazyeval         0.2.2    2019-03-15 [1] CRAN (R 3.6.0)
##  leiden           0.3.2    2020-01-18 [1] CRAN (R 3.6.0)
##  lifecycle        0.1.0    2019-08-01 [1] CRAN (R 3.6.0)
##  listenv          0.8.0    2019-12-05 [1] CRAN (R 3.6.0)
##  lmtest           0.9-37   2019-04-30 [1] CRAN (R 3.6.0)
##  lsei             1.2-0    2017-10-23 [2] CRAN (R 3.5.1)
##  magrittr         1.5      2014-11-22 [2] CRAN (R 3.5.0)
##  MASS             7.3-51.4 2019-03-31 [2] CRAN (R 3.6.0)
##  Matrix           1.2-17   2019-03-22 [2] CRAN (R 3.6.0)
##  matrixStats      0.55.0   2019-09-07 [1] CRAN (R 3.6.0)
##  mgcv             1.8-28   2019-03-21 [2] CRAN (R 3.6.0)
##  mime             0.8      2019-12-19 [1] CRAN (R 3.6.0)
##  miniUI           0.1.1.1  2018-05-18 [2] CRAN (R 3.5.1)
##  munsell          0.5.0    2018-06-12 [2] CRAN (R 3.5.0)
##  nlme             3.1-139  2019-04-09 [2] CRAN (R 3.6.0)
##  npsurv           0.4-0    2017-10-14 [2] CRAN (R 3.5.1)
##  patchwork        1.0.1    2020-06-22 [1] CRAN (R 3.6.0)
##  pbapply          1.4-2    2019-08-31 [1] CRAN (R 3.6.0)
##  pillar           1.4.3    2019-12-20 [1] CRAN (R 3.6.0)
##  pkgconfig        2.0.3    2019-09-22 [1] CRAN (R 3.6.0)
##  plotly           4.9.1    2019-11-07 [1] CRAN (R 3.6.0)
##  plyr             1.8.5    2019-12-10 [1] CRAN (R 3.6.0)
##  png              0.1-7    2013-12-03 [2] CRAN (R 3.5.0)
##  polyclip         1.10-0   2019-03-14 [1] CRAN (R 3.6.0)
##  promises         1.1.0    2019-10-04 [1] CRAN (R 3.6.0)
##  purrr            0.3.3    2019-10-18 [1] CRAN (R 3.6.0)
##  R6               2.4.1    2019-11-12 [1] CRAN (R 3.6.0)
##  RANN             2.6.1    2019-01-08 [2] CRAN (R 3.5.1)
##  RColorBrewer     1.1-2    2014-12-07 [2] CRAN (R 3.5.0)
##  Rcpp             1.0.3    2019-11-08 [1] CRAN (R 3.6.0)
##  RcppAnnoy        0.0.14   2019-11-12 [1] CRAN (R 3.6.0)
##  RcppParallel     4.4.4    2019-09-27 [1] CRAN (R 3.6.0)
##  reshape2         1.4.3    2017-12-11 [2] CRAN (R 3.5.0)
##  reticulate       1.14     2019-12-17 [1] CRAN (R 3.6.0)
##  rlang            0.4.8    2020-10-08 [1] CRAN (R 3.6.0)
##  rmarkdown        2.1      2020-01-20 [1] CRAN (R 3.6.0)
##  ROCR             1.0-7    2015-03-26 [2] CRAN (R 3.5.0)
##  rpart            4.1-15   2019-04-12 [2] CRAN (R 3.6.0)
##  rsvd             1.0.2    2019-07-29 [1] CRAN (R 3.6.0)
##  Rtsne            0.15     2018-11-10 [1] CRAN (R 3.6.0)
##  scales           1.1.0    2019-11-18 [1] CRAN (R 3.6.0)
##  sctransform      0.3      2020-09-20 [1] CRAN (R 3.6.0)
##  sessioninfo      1.1.1    2018-11-05 [1] CRAN (R 3.6.0)
##  Seurat         * 3.2.2    2020-09-26 [1] CRAN (R 3.6.0)
##  shiny            1.4.0    2019-10-10 [1] CRAN (R 3.6.0)
##  spatstat         1.64-1   2020-05-12 [1] CRAN (R 3.6.0)
##  spatstat.data    1.4-3    2020-01-26 [1] CRAN (R 3.6.0)
##  spatstat.utils   1.17-0   2020-02-07 [1] CRAN (R 3.6.0)
##  stringi          1.4.5    2020-01-11 [1] CRAN (R 3.6.0)
##  stringr          1.4.0    2019-02-10 [2] CRAN (R 3.5.1)
##  survival         2.44-1.1 2019-04-01 [2] CRAN (R 3.6.0)
##  tensor           1.5      2012-05-05 [1] CRAN (R 3.6.0)
##  tibble           2.1.3    2019-06-06 [1] CRAN (R 3.6.0)
##  tidyr            1.0.0    2019-09-11 [1] CRAN (R 3.6.0)
##  tidyselect       1.1.0    2020-05-11 [1] CRAN (R 3.6.0)
##  uwot             0.1.5    2019-12-04 [1] CRAN (R 3.6.0)
##  vctrs            0.3.6    2020-12-17 [1] CRAN (R 3.6.0)
##  viridisLite      0.3.0    2018-02-01 [2] CRAN (R 3.5.0)
##  withr            2.3.0    2020-09-22 [2] CRAN (R 3.6.0)
##  xfun             0.12     2020-01-13 [1] CRAN (R 3.6.0)
##  xtable           1.8-4    2019-04-21 [1] CRAN (R 3.6.0)
##  yaml             2.2.0    2018-07-25 [2] CRAN (R 3.5.0)
##  zoo              1.8-7    2020-01-10 [1] CRAN (R 3.6.0)
## 
## [1] /data/home/mafeiyang/R/x86_64-redhat-linux-gnu-library/3.6
## [2] /usr/lib64/R/library
## [3] /usr/share/R/library